# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer:
pkgname=py3-gtts
pkgver=2.5.0
pkgrel=0
pkgdesc="A Python library and CLI tool to interface with Google Translate text-to-speech API"
url="https://github.com/pndurette/gTTS"
arch="noarch"
license="MIT"
depends="
	py3-click
	py3-requests
	"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="
	py3-pytest
	py3-testfixtures
	"
subpackages="$pkgname-pyc"
source="https://github.com/pndurette/gTTS/archive/v$pkgver/gTTS-$pkgver.tar.gz"
# Net required for tests
options="net"
builddir="$srcdir/gTTS-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl

	rm -r "$pkgdir"/usr/lib/python3*/site-packages/gtts/tests/
	rm -r "$pkgdir"/usr/lib/python3*/site-packages/gtts/tokenizer/tests/
}

sha512sums="
f1f5f56f3b1b29f81ba9d2d1be8682888a6cd3248a2fb80c4f78d0affb4ac68b32c8d6b61cc2f44a8a21769437446be804b8c3105289d933eca3b515b2af3257  gTTS-2.5.0.tar.gz
"
